<template>
  <div class="flex gap-4 flex-wrap">
    <LightVue />
    <UploadGroup v-bind="createConfig"></UploadGroup>
    <UploadGroup v-bind="updateConfig"></UploadGroup>
    <UploadGroup v-bind="migrationConfig"></UploadGroup>
    <a-button-group>
      <a-button @click="downloadFileTemplate(item.url)" v-for="item in exportList">
        {{ t(item.title) }}
        <DownloadOutlined />
      </a-button>
    </a-button-group>
  </div>
</template>

<script setup lang="ts">
import { downloadFileTemplate, type UploadGroupParams } from '@/api/modules/utils/files';
import LightVue from './light.vue';
const { t } = useI18n();
let exportList = [
  {
    url: '/priceTag/priceTag/export',
    title: '标签信息',
  },
  {
    url: '/priceTag/priceTag/manifest?scope=0',
    title: '设备清单',
  },
  {
    url: '/priceTag/priceTag/relations?scope=0',
    title: '设备关系',
  },
];
const createConfig: UploadGroupParams = {
  uploadType: '',
  downloadType: '0',
  downloadLink: `/priceTag/priceTag/warehouse/xlsx`,
  uploadLink: `/priceTag/priceTag/warehouse/xlsx`,
  uploadText: '标签批量新增',
  showResult: true,
};
const updateConfig: UploadGroupParams = {
  uploadType: '',
  downloadType: '',
  downloadLink: `/priceTag/priceTag/xlsx`,
  uploadLink: `/priceTag/priceTag/xlsx`,
  uploadText: '标签批量绑定',
  showResult: false,
};

const migrationConfig: UploadGroupParams = {
  uploadType: '0',
  downloadType: '',
  downloadLink: `/priceTag/priceTag/shift/xlsx`,
  uploadLink: `/priceTag/priceTag/shift/xlsx`,
  uploadText: '批量迁移',
  showResult: true,
};
</script>

<style lang="scss" scoped>
.light {
  &:hover {
    background: rgb(250 204 21 / var(--tw-bg-opacity));
  }
}
</style>
